Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): Update test files to work with Docker Compose v2 #82

Merged

Conversation

deadlycoconuts
Copy link
Contributor

@deadlycoconuts deadlycoconuts commented Aug 5, 2024

What this PR does / why we need it:
It seems like v1 of Docker Compose has just been removed from all ubuntu GitHub runners as of the 29th of July (and has been ongoing since that day). This has broken the CICD pipelines of lots of repos (just take a look at the number of times that issue has been referenced), including XP. As such we can no longer run commands like docker-compose in the GitHub runners anymore and need to start updating them to use the v2 commands (to docker compose for this particular example).

For XP in particular, what broke were the Treatment Service integration tests, where we were using the testcontainers package to spin up Kafka. This version however, is also similarly super old, and calls docker-compose (v1) to spin containers in Go code. As such, this PR updates the version of testcontainers (which also requires some additional changes to the methods we need to call) so that the Docker Compose v2 commands are used instead.

Summary of Changes:

  • Renaming of docker-compose to docker compose
  • Bumping of testcontainers version
  • Bumping of Go version (I didn't want this but we need to bump to the later/latest version of testcontainers)
  • Bumping of the Go linter versions (in order to work with the newer Go version)
  • Bumping of all other random dependencies after running go mod tidy in all places
  • Replacement of the deprecated io/ioutil package methods with io methods (this mostly applied to the autogenerated code in clients/management/managementclient.go and clients/treatment/treatmentclient.go; I could've regenerated the code with a newer version of the code generator but I just decided to use my IDE to replace them)
  • Refactoring of the integration test setup script in treatment-service/integration-test/fetch_treatment_it_test.go to use the new Docker Compose v2 commands
  • Change to the existing unit test in treatment-service/models/storage_test.go to ensure that an existing unit test no longer breaks because it's performing a check on a randomly generated ID

Which issue(s) this PR fixes:

Fixes #

@deadlycoconuts deadlycoconuts added the bug Something isn't working label Aug 5, 2024
@deadlycoconuts deadlycoconuts self-assigned this Aug 5, 2024
@deadlycoconuts deadlycoconuts changed the title chore(tests): Update test files to work with Docker v2 API chore(tests): Update test files to work with Docker Compose v2 Aug 5, 2024
@deadlycoconuts deadlycoconuts force-pushed the fix_broken_treatment_svc_tests branch 5 times, most recently from a824d88 to b7c0e05 Compare August 7, 2024 10:58
@deadlycoconuts deadlycoconuts marked this pull request as ready for review August 7, 2024 13:38
Copy link

@tiopramayudi tiopramayudi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some comments, the rest is LGTM! Thanks @deadlycoconuts

management-service/go.mod Show resolved Hide resolved
treatment-service/models/storage_test.go Show resolved Hide resolved
@deadlycoconuts deadlycoconuts merged commit 4aee007 into caraml-dev:main Aug 8, 2024
11 checks passed
@deadlycoconuts deadlycoconuts deleted the fix_broken_treatment_svc_tests branch August 8, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants